<template>
	<!-- 添加弹框 -->
	<el-dialog title=""  visible :show-close="false" :append-to-body="true" class="wrap" @close="cancel" :close-on-click-modal="false">
		<i class="el-icon-close close" @click="cancel" style="color: white;z-index: 99;"></i>
		 <div class="bt">添加职位分类</div>
		 <el-form label-width="100px" class="form">
		  <el-form-item label="职位名称">
 				<el-input v-model="mc"  placeholder="请输入职位名称" class="select-block"></el-input>
 			</el-form-item>
            <el-form-item label="备注">
 				<el-input v-model="note" type="textarea"  :rows="4" placeholder="请输入备注" class="select-block"></el-input>
 			</el-form-item>
		</el-form>
		<el-button type="primary" class="submit" @click="submit">添加</el-button>
	</el-dialog>
</template>
<script type="text/javascript">
	import qs from 'qs'
	export default {
		data() {
			return {
				dialogTableVisible: true,
				textbook: '',
				note:'',
				mc: '',
			}
		},
		methods: {
			submit() {
				//检测
				this.$store.state.loading = true;
				if(!this.mc) {
					this.$message.warning('请填写职位名称');
					this.$store.state.loading = false;
					return;
				}
//				else if(!this.ms){
//					this.$message.warning('请填写描述内容');
//					this.$store.state.loading = false;
//					return;
//				}
				var logininfo = JSON.parse(localStorage.logininfo);
				var params3 = qs.stringify({
					yhid: logininfo.id,
					xxid:logininfo.xxid,
					mc: this.mc,
					note: this.note
				});
				//执行
				// console.log(params3)
				this.axios.post(this.$store.state.api + 'lstype/insert', params3)
					.then(res => {
						if(res.data.code == 1) {
							this.$emit('close', { type: 'fladd', cancel: false });
							this.$store.state.loading = false;
						} else {
						    this.$message.warning(res.data.msg);
							this.$store.state.loading = false;
						}
					}).catch(res => {
						this.$message.warning("服务器繁忙，请重试");
						this.$store.state.loading = false;
					})
			},
			cancel() {
				this.$emit('close', { type: 'fladd', cancel: true })
			}
		}
	}
</script>
<style lang="less" scoped>
	.wrap {
		.input-block {
			margin-bottom: 20px;
			text-align: center;
		}
		.bt{
			position: absolute;
			width: 100%;
			height: 50px;
			margin: 0 auto;
			top:0;
			left:0;
			background: #50BFFF;
			margin-bottom: 20px;
			color:white;
			text-align:left;
			line-height: 50px;
			font-size: 17px;
			padding-left: 15px;
		}
		.form {
		text-align: left;
		margin-top: 20px;

	}
		.input {
			display: inline-block;
		}
		.select-block {
 		display: block;
 		width: 85%;
 	}
		.submit {
			width: 120px;
			display: block;
			margin: 0 auto;
			margin-top: 20px;
		}
	}
</style>
